package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {

        Thread rose = new Thread("rose"){
            @Override
            public void run() {
                for (int i = 0; i < 6; i++) {
                    System.out.println(getName() + "正在准备跳船");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                }
                System.out.println("跳下去了，噗通！");
            }
        };

        Thread jack = new Thread("jack"){
            @Override
            public void run() {
                while (true) {
                    System.out.println(getName()+":u jump i jump");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                    }
                }
            }
        };

        rose.start();
        jack.setDaemon(true);
        jack.start();
        //while (true);
    }
}
